blitter: model the line micro-programs against vAmiga's SlowBlitter#150
Merged
Conversation
be09226 to
c30311c
Compare
Line blits previously ran a fixed four-cycle pixel cadence keyed only on USEC. Model the USEB/USEC-indexed micro-programs instead, verified cycle-for-cycle against VAMIGA_BLT_PROBE traces (bususage1l/5l/15l): - USEB lines take six cycles per pixel: an LB cycle fetches B (adding only BLTBMOD to BLTBPT) and a bare LBus cycle allocates the bus with no transfer; their terminal BLTDONE cycle is BUSIDLE-class and waits for a free bus. - With USEC set, the line WRITE_D cycle allocates the bus even when SING suppresses the store (copy mode's lockD busidle rule does not apply in line mode); the suppression only locks the store, so the A shifter, minterm and BZERO update still see the full inputs (line/zero1). - The line texture is BLTBDAT rotated by the LIVE BSH each pixel (vAmiga HOLD_B re-runs the shifter); the BLTBDAT write-time latch applies only to the USEB-off copy hold word (line/bsh3, bsh4). - The Bresenham error accumulator (BLTAPT's low word) advances only while USEA is enabled (vAmiga doLine). - C DMA fetches load the BLTCDAT register itself, so a later USEC-off blit consumes the last fetched C word (line/zero1 blits 7-12). vAmigaTS: Agnus/Blitter/line 35.02 -> 0.80 summed diff%, timing -6.8, worst per-case regression +0.87pp (bususage4l group, bounded by the CPU-write beam-phase class). STATE_VERSION 27: LineBlitState gained use_a/use_b/bpt and the LB/LBus phases.
Document the USEB/USEC-indexed line micro-programs (six-cycle USEB pixels, line WRITE_D bus allocation under SING, live-BSH texture, USEA-gated accumulator, BLTCDAT C-hold) in docs/internals/timing.md and the COPPERLINE_DIAG_CPU_WRITES knob in docs/debugger/headless.md.
c30311c to
685bd31
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was stacked on #149 (
fix/unified-write-effect-pipeline); #149 has sinceMERGED and this branch is rebased onto main (063af0d). The PR now carries
two commits: the line-blit micro-program model and its docs.
Reconciliation with #149 (write-effect overlap)
The original copvbl commit here made the Denise write-effect delay
source-independent from the live beam position. #149 landed the more complete
model: CPU write effects referenced from the granted chip-bus slot
(
cpu_custom_access_slot), with per-class delays (Denise-class +4 cck; Agnustwo-cycle class DMACON/BPLxPT/BPLxMOD/SPRxPT +2 cck, vAmiga
recordRegisterChange(DMA_CYCLES(2))). vAmiga'spokeCustom16positionscorrespond to the granted slot, so #149's reference point is the correct one -
in my copvbl probe runs CL's live-beam positions coincided with vAmiga's
pokes, which is the same +2 bus-cycle tail #149 identifies. The copvbl render
commit and the duplicate
COPPERLINE_DIAG_CPU_WRITESprobe were thereforeDROPPED in favour of #149's implementations: the write-effect delay is applied
exactly once per event, in
record_render_write, under #149's two-classmodel. The collision-events raw-landing split from the dropped commit was not
re-added: #149 recalibrated the staged collision tests against the delayed
positions and the suite is green on the stack.
Verified on the stack: this branch adds exactly ZERO delta to Agnus/Copper vs
#149 alone (max per-case delta +0.00); #149 itself nets copvbl 236.9 -> 236.4
and coptim 44.2 -> 42.5 vs the pre-#149 main.
Line-blit micro-programs (this PR's work)
The line engine ran a fixed 4-cycle pixel cadence keyed only on USEC.
vAmiga's SlowBlitter has four line micro-programs indexed by the USEB/USEC
pair; now modelled and trace-verified cycle-for-cycle relative to the BLTSIZE
poke (two-sided
COPPERLINE_DIAG_BLT_SLOTS/VAMIGA_BLT_PROBEonbususage1lBC=00,bususage5lBC=10,bususage15lBC=11), stalls included:a bare bus-allocation cycle; their terminal BLTDONE micro-cycle is
BUSIDLE-class (waits for a free bus).
mode's lockD-busidle rule does not apply in line mode); suppression only
locks the store, so the minterm/BZERO still see the full inputs (
zero1).bsh3/bsh4);the write-time BLTBDAT latch applies only to the USEB-off copy hold word
(
undocumented1unchanged).fetched C word (
zero1blits 7-12).STATE_VERSION26 -> 27 (LineBlitState gained use_a/use_b/bpt and theLB/LBus phases).
Numbers (summed diff% per bucket; pre-#149 main / #149 alone / this branch)
Agnus/Blitter: 1647.6 / 1578.6 / 1535.8 (marginal vs #149: -42.8)
bususage -1.1
bbusy7l+1.04pp (BBUSY poll-exitquantization against the now-slower 6-cycle USEB lines; the blit itself is
trace-exact),
bususage4l/5l/12l/13l+0.62pp each (BC=10 group; CPU-writebeam-phase class, blitter side trace-exact)
Agnus/Copper: 949.1 / 930.5 / 930.5 (marginal vs #149: 0.00)
Honest residual
The copvbl b/c variants (+1.5pp each under #149's model) and the small
line-mode bususage/bbusy counter-moves are the previously-characterized
interrupt-recognition/CPU beam-phase class: the copvbl1b two-sided trace shows
both emulators landing the copper
MOVE INTREQat (312,$3c), with vAmiga'shandler phase unchanged vs
copvbl1while Copperline's recognition quantizesto a different instruction boundary (its poll-boundary grid sits ~2 cck
early). A +1 cck copper-INTREQ latch-delay experiment measured strictly worse
(copvbl 247.6 -> 273.6 under the old model), confirming the offset lives in
the CPU instruction grid, not in a recognition constant.
Gates
cargo test --libgreen (1346 passed on merged main base);clippy --all-targets --all-features --locked -- -D warningsclean;fmtcleanbase and merged main 063af0d
pre-Unify the register-write effect pipeline: slot-referenced write-effect delays for CPU writes #149 main (236.4 vs 236.9)
vamigats-reports/*.patch); no reference-source changesdocs/internals/timing.md(line micro-programs; Unify the register-write effect pipeline: slot-referenced write-effect delays for CPU writes #149's write-effectsection kept as-is),
docs/debugger/headless.md(COPPERLINE_DIAG_CPU_WRITES)